In the development of computer software, it is necessary to perform a function termed "debugging" which involves testing and evaluating the software to find and correct errors and improper operation. An effective debugger program is necessary for rapid and efficient development of software.
The original coding for a computer program is termed the source code. This is the code that is written and understood by a programmer. The source code is processed by a program termed a compiler to produce an assembly code. The assembly code is then further processed by a program termed an assembler to produce an object file. Multiple object files are linked by a loader program to produce an executable program which is termed the object code, which comprises binary machine language instructions that can be executed directly by a computer.
In testing software, the object code must be executed by a computer in a testing phase so that proper operation of the code can be determined and any errors or spurious operations can be detected. When a problem is detected at a particular location in the object code, a correction of that error must generally be made in the original source code. However, in most cases, it is not readily apparent which portion of the object code relates directly back to a particular line or construct of the source code. It is therefore an important function of the debugger program to provide such a relationship. This is termed debugging of the source code at a symbolic, source code, level.
A debugger program crucially relies on its ability to map from a symbolic construct in the source code to a point(s) in the object code and to map back from a point in the object code to a construct(s) in the source code. With this capability, the debugger program allows a user to:
1. set breakpoints and tracepoints in source code terms. PA1 2. allow the debugger to incrementally step (execute) constructs in the source or object code. PA1 3. allow the debugger program to communicate the current point of execution in the object code to terms of the source code. PA1 4. given a point in the program (object code), allows the debugger program to determine the correct lexical context in which to interpret user defined program symbols.
A major factor of complexity arises in the operation of a debugger program when the object code is optimized. Optimization is a process performed in certain compilers which enhances the speed of operation of the resulting compiled code. When a source code program is compiled with optimization, the relationships between the source code and the resulting object code is much more complex than in the case of compilation without optimization.
In compiler-debugger systems, without optimization, the source code to object code correlation is accomplished by partitioning the source code and then relating each partition to a single instruction in the object code. For example, in most Unix debugger programs, the source code is partitioned into lines and each line is related to a single instruction in the object code. When there is no optimization of the object code, it is sufficient to relate a source code construct to a single contiguous set of instructions to provide basic debugging functionality. Further, the instructions which comprise a source code construct will appear in a contiguous section of the object code. All instructions which correspond to a particular source code construct can be readily determined.
However, in the presence of optimization for the object code, all instructions which correspond to a source code construct will not necessarily be contiguous in the object code. The use of optimization can drastically reorder, eliminate, replicate, factor, fuse and transform source code elements. Instructions corresponding to a particular source code construct may appear in widely disparate sections of the object code. Because of such fragmentation in the object code for a source code construct, correlating a source code construct to a single instruction is not sufficient to enable standard debugging functionality.
The process of optimization for "C" code is described in "CONVEX "C" OPTIMIZATION GUIDE" 2nd Edition, Convex Press, Richardson, Tex., April, 1991. Operation of FORTRAN code is described in "CONVEX FORTRAN OPTIMIZATION GUIDE", 3rd Edition, Convex Press, Richardson, Tex., November, 1991.
In view of the desirability to optimize object code, there exists a need to relate each source code construct to one or more ranges of instructions in the object code. There is further a need to provide a system and method for communicating this correlation of source code to object code to the debugger program. Still further, there is a need to provide a system and method for utilizing this information to accomplish the functions required in a debugger program.